Recap of R packages

Søren Helweg Dam

Exercises recap

Lab 8 Learning Objectives

  • Prepare a simple R package for distributing documented functions

  • Explain the terms Repository, Dependency, and Namespace

  • Implement testing in an R package

  • Collaboratively work on an R package on GitHub

What is an R package?

  • A shareable collection of documented code and/or data

The package you built

Assignment recap

Group assignment

  • Make an R package that simulate (more or less) the central dogma of molecular biology.
  • Discuss why it is a good idea to limit the number of dependencies your package has. When can’t it be avoided?
  • Discuss the difference between adding an @importFrom package function tag to a function description compared to using package::function().
  • Write a vignette (user guide)

Package names

  • centralDogma / Centraldog / cdogma
  • Cdogr
  • BioFlow
  • gene2protein
  • biocd
  • dogmaVis
  • dogmaXX
  • groupXX

Dependencies

  • They increase the size of our package.

  • Can introduce compatibility issues.

  • They are nearly unavoidable.

Namespace

  • Extent your package’s namespace with dependency imports
    • @importFrom package function and @import package
    • What is actually the difference?
  • package::function
    • clutters the code…
    • and can be tiresome if used heavily…
    • but ensure better understanding.